package com.example.demo2.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@ResponseBody
@RequestMapping("/test")
@Slf4j
public class EnvController {

    @Value("${server.port:}")
    private Integer port;
    /**
     * server.port从8888改成9999
     * http://127.0.0.1:9999/test/env
     * http://127.0.0.1:8888/test/env
     */
    @RequestMapping(value = "/env", method = RequestMethod.GET)
    public Object env() {
        return port;
    }
}
